package com.bj58.mis.apm.apm.scf.mapper;

import com.bj58.mis.apm.apm.scf.module.KylinCube;
import com.bj58.mis.apm.apm.scf.module.KylinProject;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * @author zhangyu84
 * @create 2018/7/6
 * @since 1.0.0
 */
public interface KylinCubeRepository extends JpaRepository<KylinCube,Long> {
   KylinCube getByNameAndDeleted(String name,int deleted);

   @Modifying
   @Query(value = "update kylin_cube c,roc_auth_cube  r\n" +
           "set c.name=r.cube_name_ch,c.creater=r.creator,c.creater_real_name=r.creator_name,\n" +
           "c.mender=r.modifier,c.mender_real_name=r.modifier_name,c.cycle=r.cycle\n"+
           "where c.id=r.cube_id and r.cube_name_ch is not null",nativeQuery = true)
   void updateCubeNameCh();
}
